package cn.com.cifi.mars.mapper.wrapper;

import cn.com.cifi.mars.entity.PriceVersion;
import cn.com.cifi.mars.mapper.mars.PriceVersionMapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author: JingYuanXiang
 * @date: 2020/11/21 14:30
 */
@Component
public class PriceVersionWrapper {

    @Autowired
    private PriceVersionMapper priceVersionMapper;

    /**
     * 查询货值版本数量
     * @param projectfId 分期id
     * @param versionType 版本类型
     * @param versionState 版本状态
     * @param isDelete 是否删除
     * @return
     */
    public Integer selectCountByProjectfIdAndVersionTypeAndVersionState(String projectfId, String versionType, List<String> versionState, int isDelete){
        QueryWrapper<PriceVersion> queryWrapper = new QueryWrapper();
        queryWrapper.eq("projectf_id",projectfId)
                .eq("version_type",versionType)
                .in("version_state", versionState)
                .eq("is_delete", isDelete);

        return priceVersionMapper.selectCount(queryWrapper);
    }
}
